using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Text;

namespace Data_Access_Tier
{
	public class HRM_SALARYData : DatabaseObjectBase
	{
		public HRM_SALARYData()
		{
			Initialize(true);
		}
		public HRM_SALARYData(Boolean newConnection)
		{
			Initialize(newConnection);
		}

		public Int32 HRM_SALARY_Insert(Guid SalaryTableListID, String EmployeeCode, Decimal MinimumSalary, Double CoefficientSalary, Decimal BasicSalary, Decimal InsuranceSalary, Double StipulatedTime, Double WorkHour, Double LateEarlyHour, Decimal MinusLateEarly, Decimal MinusMoney, Decimal AllowanceInsurance, Decimal Allowance, Decimal TotalSalary, Decimal SocialInsurance, Decimal HealthInsurance, Decimal UnemploymentInsurance, Decimal Insurance, Decimal Union, Decimal IncomeTax, Int32 NumberDepend, Decimal DependMoney, Decimal IncomeTaxRemain, Decimal IncomeTaxMoney, Decimal RemainSalary, Decimal Advance, Decimal Assignment, Decimal SalaryPlus, Decimal SalaryMinus, Decimal Salary, Decimal SalaryPay, Decimal SalaryDebt)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.InsertCommand = new SqlCommand("HRM_SALARY_Insert");
				_dbadapter.InsertCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.InsertCommand.Connection = _dbconn;
				_trans = _dbconn.BeginTransaction();
				_dbadapter.InsertCommand.Transaction = _trans;
				_dbadapter.InsertCommand.Parameters.Clear();
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@SalaryTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MinimumSalary", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@CoefficientSalary", SqlDbType.Float));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BasicSalary", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@InsuranceSalary", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@StipulatedTime", SqlDbType.Float));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@WorkHour", SqlDbType.Float));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@LateEarlyHour", SqlDbType.Float));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MinusLateEarly", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MinusMoney", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@AllowanceInsurance", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Allowance", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TotalSalary", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@SocialInsurance", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@HealthInsurance", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@UnemploymentInsurance", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Insurance", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Union", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IncomeTax", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@NumberDepend", SqlDbType.Int));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@DependMoney", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IncomeTaxRemain", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IncomeTaxMoney", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@RemainSalary", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Advance", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Assignment", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@SalaryPlus", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@SalaryMinus", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Salary", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@SalaryPay", SqlDbType.Money));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@SalaryDebt", SqlDbType.Money));
				_dbadapter.InsertCommand.Prepare();
				SqlGuid SalaryTableListIDSQL = SalaryTableListID;
				_dbadapter.InsertCommand.Parameters["@SalaryTableListID"].Value = SalaryTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.InsertCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlMoney MinimumSalarySQL = MinimumSalary;
				_dbadapter.InsertCommand.Parameters["@MinimumSalary"].Value = MinimumSalarySQL;
				SqlDouble CoefficientSalarySQL = CoefficientSalary;
				_dbadapter.InsertCommand.Parameters["@CoefficientSalary"].Value = CoefficientSalarySQL;
				SqlMoney BasicSalarySQL = BasicSalary;
				_dbadapter.InsertCommand.Parameters["@BasicSalary"].Value = BasicSalarySQL;
				SqlMoney InsuranceSalarySQL = InsuranceSalary;
				_dbadapter.InsertCommand.Parameters["@InsuranceSalary"].Value = InsuranceSalarySQL;
				SqlDouble StipulatedTimeSQL = StipulatedTime;
				_dbadapter.InsertCommand.Parameters["@StipulatedTime"].Value = StipulatedTimeSQL;
				SqlDouble WorkHourSQL = WorkHour;
				_dbadapter.InsertCommand.Parameters["@WorkHour"].Value = WorkHourSQL;
				SqlDouble LateEarlyHourSQL = LateEarlyHour;
				_dbadapter.InsertCommand.Parameters["@LateEarlyHour"].Value = LateEarlyHourSQL;
				SqlMoney MinusLateEarlySQL = MinusLateEarly;
				_dbadapter.InsertCommand.Parameters["@MinusLateEarly"].Value = MinusLateEarlySQL;
				SqlMoney MinusMoneySQL = MinusMoney;
				_dbadapter.InsertCommand.Parameters["@MinusMoney"].Value = MinusMoneySQL;
				SqlMoney AllowanceInsuranceSQL = AllowanceInsurance;
				_dbadapter.InsertCommand.Parameters["@AllowanceInsurance"].Value = AllowanceInsuranceSQL;
				SqlMoney AllowanceSQL = Allowance;
				_dbadapter.InsertCommand.Parameters["@Allowance"].Value = AllowanceSQL;
				SqlMoney TotalSalarySQL = TotalSalary;
				_dbadapter.InsertCommand.Parameters["@TotalSalary"].Value = TotalSalarySQL;
				SqlMoney SocialInsuranceSQL = SocialInsurance;
				_dbadapter.InsertCommand.Parameters["@SocialInsurance"].Value = SocialInsuranceSQL;
				SqlMoney HealthInsuranceSQL = HealthInsurance;
				_dbadapter.InsertCommand.Parameters["@HealthInsurance"].Value = HealthInsuranceSQL;
				SqlMoney UnemploymentInsuranceSQL = UnemploymentInsurance;
				_dbadapter.InsertCommand.Parameters["@UnemploymentInsurance"].Value = UnemploymentInsuranceSQL;
				SqlMoney InsuranceSQL = Insurance;
				_dbadapter.InsertCommand.Parameters["@Insurance"].Value = InsuranceSQL;
				SqlMoney UnionSQL = Union;
				_dbadapter.InsertCommand.Parameters["@Union"].Value = UnionSQL;
				SqlMoney IncomeTaxSQL = IncomeTax;
				_dbadapter.InsertCommand.Parameters["@IncomeTax"].Value = IncomeTaxSQL;
				SqlInt32 NumberDependSQL = NumberDepend;
				_dbadapter.InsertCommand.Parameters["@NumberDepend"].Value = NumberDependSQL;
				SqlMoney DependMoneySQL = DependMoney;
				_dbadapter.InsertCommand.Parameters["@DependMoney"].Value = DependMoneySQL;
				SqlMoney IncomeTaxRemainSQL = IncomeTaxRemain;
				_dbadapter.InsertCommand.Parameters["@IncomeTaxRemain"].Value = IncomeTaxRemainSQL;
				SqlMoney IncomeTaxMoneySQL = IncomeTaxMoney;
				_dbadapter.InsertCommand.Parameters["@IncomeTaxMoney"].Value = IncomeTaxMoneySQL;
				SqlMoney RemainSalarySQL = RemainSalary;
				_dbadapter.InsertCommand.Parameters["@RemainSalary"].Value = RemainSalarySQL;
				SqlMoney AdvanceSQL = Advance;
				_dbadapter.InsertCommand.Parameters["@Advance"].Value = AdvanceSQL;
				SqlMoney AssignmentSQL = Assignment;
				_dbadapter.InsertCommand.Parameters["@Assignment"].Value = AssignmentSQL;
				SqlMoney SalaryPlusSQL = SalaryPlus;
				_dbadapter.InsertCommand.Parameters["@SalaryPlus"].Value = SalaryPlusSQL;
				SqlMoney SalaryMinusSQL = SalaryMinus;
				_dbadapter.InsertCommand.Parameters["@SalaryMinus"].Value = SalaryMinusSQL;
				SqlMoney SalarySQL = Salary;
				_dbadapter.InsertCommand.Parameters["@Salary"].Value = SalarySQL;
				SqlMoney SalaryPaySQL = SalaryPay;
				_dbadapter.InsertCommand.Parameters["@SalaryPay"].Value = SalaryPaySQL;
				SqlMoney SalaryDebtSQL = SalaryDebt;
				_dbadapter.InsertCommand.Parameters["@SalaryDebt"].Value = SalaryDebtSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.InsertCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_SALARY_Insert: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_SALARY_Insert: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.InsertCommand != null)
					_dbadapter.InsertCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_SALARY_Update(Guid SalaryTableListID, String EmployeeCode, Decimal MinimumSalary, Double CoefficientSalary, Decimal BasicSalary, Decimal InsuranceSalary, Double StipulatedTime, Double WorkHour, Double LateEarlyHour, Decimal MinusLateEarly, Decimal MinusMoney, Decimal AllowanceInsurance, Decimal Allowance, Decimal TotalSalary, Decimal SocialInsurance, Decimal HealthInsurance, Decimal UnemploymentInsurance, Decimal Insurance, Decimal Union, Decimal IncomeTax, Int32 NumberDepend, Decimal DependMoney, Decimal IncomeTaxRemain, Decimal IncomeTaxMoney, Decimal RemainSalary, Decimal Advance, Decimal Assignment, Decimal SalaryPlus, Decimal SalaryMinus, Decimal Salary, Decimal SalaryPay, Decimal SalaryDebt)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_SALARY_Update");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MinimumSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@CoefficientSalary", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BasicSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsuranceSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@StipulatedTime", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@WorkHour", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LateEarlyHour", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MinusLateEarly", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MinusMoney", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllowanceInsurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TotalSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SocialInsurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HealthInsurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@UnemploymentInsurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Insurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Union", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IncomeTax", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@NumberDepend", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@DependMoney", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IncomeTaxRemain", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IncomeTaxMoney", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@RemainSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Advance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Assignment", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryPlus", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryMinus", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Salary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryPay", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryDebt", SqlDbType.Money));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid SalaryTableListIDSQL = SalaryTableListID;
				_dbadapter.UpdateCommand.Parameters["@SalaryTableListID"].Value = SalaryTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlMoney MinimumSalarySQL = MinimumSalary;
				_dbadapter.UpdateCommand.Parameters["@MinimumSalary"].Value = MinimumSalarySQL;
				SqlDouble CoefficientSalarySQL = CoefficientSalary;
				_dbadapter.UpdateCommand.Parameters["@CoefficientSalary"].Value = CoefficientSalarySQL;
				SqlMoney BasicSalarySQL = BasicSalary;
				_dbadapter.UpdateCommand.Parameters["@BasicSalary"].Value = BasicSalarySQL;
				SqlMoney InsuranceSalarySQL = InsuranceSalary;
				_dbadapter.UpdateCommand.Parameters["@InsuranceSalary"].Value = InsuranceSalarySQL;
				SqlDouble StipulatedTimeSQL = StipulatedTime;
				_dbadapter.UpdateCommand.Parameters["@StipulatedTime"].Value = StipulatedTimeSQL;
				SqlDouble WorkHourSQL = WorkHour;
				_dbadapter.UpdateCommand.Parameters["@WorkHour"].Value = WorkHourSQL;
				SqlDouble LateEarlyHourSQL = LateEarlyHour;
				_dbadapter.UpdateCommand.Parameters["@LateEarlyHour"].Value = LateEarlyHourSQL;
				SqlMoney MinusLateEarlySQL = MinusLateEarly;
				_dbadapter.UpdateCommand.Parameters["@MinusLateEarly"].Value = MinusLateEarlySQL;
				SqlMoney MinusMoneySQL = MinusMoney;
				_dbadapter.UpdateCommand.Parameters["@MinusMoney"].Value = MinusMoneySQL;
				SqlMoney AllowanceInsuranceSQL = AllowanceInsurance;
				_dbadapter.UpdateCommand.Parameters["@AllowanceInsurance"].Value = AllowanceInsuranceSQL;
				SqlMoney AllowanceSQL = Allowance;
				_dbadapter.UpdateCommand.Parameters["@Allowance"].Value = AllowanceSQL;
				SqlMoney TotalSalarySQL = TotalSalary;
				_dbadapter.UpdateCommand.Parameters["@TotalSalary"].Value = TotalSalarySQL;
				SqlMoney SocialInsuranceSQL = SocialInsurance;
				_dbadapter.UpdateCommand.Parameters["@SocialInsurance"].Value = SocialInsuranceSQL;
				SqlMoney HealthInsuranceSQL = HealthInsurance;
				_dbadapter.UpdateCommand.Parameters["@HealthInsurance"].Value = HealthInsuranceSQL;
				SqlMoney UnemploymentInsuranceSQL = UnemploymentInsurance;
				_dbadapter.UpdateCommand.Parameters["@UnemploymentInsurance"].Value = UnemploymentInsuranceSQL;
				SqlMoney InsuranceSQL = Insurance;
				_dbadapter.UpdateCommand.Parameters["@Insurance"].Value = InsuranceSQL;
				SqlMoney UnionSQL = Union;
				_dbadapter.UpdateCommand.Parameters["@Union"].Value = UnionSQL;
				SqlMoney IncomeTaxSQL = IncomeTax;
				_dbadapter.UpdateCommand.Parameters["@IncomeTax"].Value = IncomeTaxSQL;
				SqlInt32 NumberDependSQL = NumberDepend;
				_dbadapter.UpdateCommand.Parameters["@NumberDepend"].Value = NumberDependSQL;
				SqlMoney DependMoneySQL = DependMoney;
				_dbadapter.UpdateCommand.Parameters["@DependMoney"].Value = DependMoneySQL;
				SqlMoney IncomeTaxRemainSQL = IncomeTaxRemain;
				_dbadapter.UpdateCommand.Parameters["@IncomeTaxRemain"].Value = IncomeTaxRemainSQL;
				SqlMoney IncomeTaxMoneySQL = IncomeTaxMoney;
				_dbadapter.UpdateCommand.Parameters["@IncomeTaxMoney"].Value = IncomeTaxMoneySQL;
				SqlMoney RemainSalarySQL = RemainSalary;
				_dbadapter.UpdateCommand.Parameters["@RemainSalary"].Value = RemainSalarySQL;
				SqlMoney AdvanceSQL = Advance;
				_dbadapter.UpdateCommand.Parameters["@Advance"].Value = AdvanceSQL;
				SqlMoney AssignmentSQL = Assignment;
				_dbadapter.UpdateCommand.Parameters["@Assignment"].Value = AssignmentSQL;
				SqlMoney SalaryPlusSQL = SalaryPlus;
				_dbadapter.UpdateCommand.Parameters["@SalaryPlus"].Value = SalaryPlusSQL;
				SqlMoney SalaryMinusSQL = SalaryMinus;
				_dbadapter.UpdateCommand.Parameters["@SalaryMinus"].Value = SalaryMinusSQL;
				SqlMoney SalarySQL = Salary;
				_dbadapter.UpdateCommand.Parameters["@Salary"].Value = SalarySQL;
				SqlMoney SalaryPaySQL = SalaryPay;
				_dbadapter.UpdateCommand.Parameters["@SalaryPay"].Value = SalaryPaySQL;
				SqlMoney SalaryDebtSQL = SalaryDebt;
				_dbadapter.UpdateCommand.Parameters["@SalaryDebt"].Value = SalaryDebtSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_SALARY_Update: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_SALARY_Update: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_SALARY_Disable(Guid SalaryTableListID, String EmployeeCode, ref Boolean Enabled)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_SALARY_Disable");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@enabled", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid SalaryTableListIDSQL = SalaryTableListID;
				_dbadapter.UpdateCommand.Parameters["@SalaryTableListID"].Value = SalaryTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				_dbadapter.UpdateCommand.Parameters["@enabled"].Direction = ParameterDirection.Output;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_SALARY_Disable: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_SALARY_Disable: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_SALARY_Delete(Guid SalaryTableListID, String EmployeeCode)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.DeleteCommand = new SqlCommand("HRM_SALARY_Delete");
				_dbadapter.DeleteCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.DeleteCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.DeleteCommand.Transaction = _trans;

				_dbadapter.DeleteCommand.Parameters.Clear();
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@SalaryTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.DeleteCommand.Prepare();
				SqlGuid SalaryTableListIDSQL = SalaryTableListID;
				_dbadapter.DeleteCommand.Parameters["@SalaryTableListID"].Value = SalaryTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.DeleteCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.DeleteCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_SALARY_Delete: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_SALARY_Delete: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.DeleteCommand != null)
					_dbadapter.DeleteCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_SALARY_Save(Guid SalaryTableListID, String EmployeeCode, Decimal MinimumSalary, Double CoefficientSalary, Decimal BasicSalary, Decimal InsuranceSalary, Double StipulatedTime, Double WorkHour, Double LateEarlyHour, Decimal MinusLateEarly, Decimal MinusMoney, Decimal AllowanceInsurance, Decimal Allowance, Decimal TotalSalary, Decimal SocialInsurance, Decimal HealthInsurance, Decimal UnemploymentInsurance, Decimal Insurance, Decimal Union, Decimal IncomeTax, Int32 NumberDepend, Decimal DependMoney, Decimal IncomeTaxRemain, Decimal IncomeTaxMoney, Decimal RemainSalary, Decimal Advance, Decimal Assignment, Decimal SalaryPlus, Decimal SalaryMinus, Decimal Salary, Decimal SalaryPay, Decimal SalaryDebt)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_SALARY_Save");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MinimumSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@CoefficientSalary", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BasicSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsuranceSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@StipulatedTime", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@WorkHour", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LateEarlyHour", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MinusLateEarly", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MinusMoney", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllowanceInsurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TotalSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SocialInsurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HealthInsurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@UnemploymentInsurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Insurance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Union", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IncomeTax", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@NumberDepend", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@DependMoney", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IncomeTaxRemain", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IncomeTaxMoney", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@RemainSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Advance", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Assignment", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryPlus", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryMinus", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Salary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryPay", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalaryDebt", SqlDbType.Money));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid SalaryTableListIDSQL = SalaryTableListID;
				_dbadapter.UpdateCommand.Parameters["@SalaryTableListID"].Value = SalaryTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlMoney MinimumSalarySQL = MinimumSalary;
				_dbadapter.UpdateCommand.Parameters["@MinimumSalary"].Value = MinimumSalarySQL;
				SqlDouble CoefficientSalarySQL = CoefficientSalary;
				_dbadapter.UpdateCommand.Parameters["@CoefficientSalary"].Value = CoefficientSalarySQL;
				SqlMoney BasicSalarySQL = BasicSalary;
				_dbadapter.UpdateCommand.Parameters["@BasicSalary"].Value = BasicSalarySQL;
				SqlMoney InsuranceSalarySQL = InsuranceSalary;
				_dbadapter.UpdateCommand.Parameters["@InsuranceSalary"].Value = InsuranceSalarySQL;
				SqlDouble StipulatedTimeSQL = StipulatedTime;
				_dbadapter.UpdateCommand.Parameters["@StipulatedTime"].Value = StipulatedTimeSQL;
				SqlDouble WorkHourSQL = WorkHour;
				_dbadapter.UpdateCommand.Parameters["@WorkHour"].Value = WorkHourSQL;
				SqlDouble LateEarlyHourSQL = LateEarlyHour;
				_dbadapter.UpdateCommand.Parameters["@LateEarlyHour"].Value = LateEarlyHourSQL;
				SqlMoney MinusLateEarlySQL = MinusLateEarly;
				_dbadapter.UpdateCommand.Parameters["@MinusLateEarly"].Value = MinusLateEarlySQL;
				SqlMoney MinusMoneySQL = MinusMoney;
				_dbadapter.UpdateCommand.Parameters["@MinusMoney"].Value = MinusMoneySQL;
				SqlMoney AllowanceInsuranceSQL = AllowanceInsurance;
				_dbadapter.UpdateCommand.Parameters["@AllowanceInsurance"].Value = AllowanceInsuranceSQL;
				SqlMoney AllowanceSQL = Allowance;
				_dbadapter.UpdateCommand.Parameters["@Allowance"].Value = AllowanceSQL;
				SqlMoney TotalSalarySQL = TotalSalary;
				_dbadapter.UpdateCommand.Parameters["@TotalSalary"].Value = TotalSalarySQL;
				SqlMoney SocialInsuranceSQL = SocialInsurance;
				_dbadapter.UpdateCommand.Parameters["@SocialInsurance"].Value = SocialInsuranceSQL;
				SqlMoney HealthInsuranceSQL = HealthInsurance;
				_dbadapter.UpdateCommand.Parameters["@HealthInsurance"].Value = HealthInsuranceSQL;
				SqlMoney UnemploymentInsuranceSQL = UnemploymentInsurance;
				_dbadapter.UpdateCommand.Parameters["@UnemploymentInsurance"].Value = UnemploymentInsuranceSQL;
				SqlMoney InsuranceSQL = Insurance;
				_dbadapter.UpdateCommand.Parameters["@Insurance"].Value = InsuranceSQL;
				SqlMoney UnionSQL = Union;
				_dbadapter.UpdateCommand.Parameters["@Union"].Value = UnionSQL;
				SqlMoney IncomeTaxSQL = IncomeTax;
				_dbadapter.UpdateCommand.Parameters["@IncomeTax"].Value = IncomeTaxSQL;
				SqlInt32 NumberDependSQL = NumberDepend;
				_dbadapter.UpdateCommand.Parameters["@NumberDepend"].Value = NumberDependSQL;
				SqlMoney DependMoneySQL = DependMoney;
				_dbadapter.UpdateCommand.Parameters["@DependMoney"].Value = DependMoneySQL;
				SqlMoney IncomeTaxRemainSQL = IncomeTaxRemain;
				_dbadapter.UpdateCommand.Parameters["@IncomeTaxRemain"].Value = IncomeTaxRemainSQL;
				SqlMoney IncomeTaxMoneySQL = IncomeTaxMoney;
				_dbadapter.UpdateCommand.Parameters["@IncomeTaxMoney"].Value = IncomeTaxMoneySQL;
				SqlMoney RemainSalarySQL = RemainSalary;
				_dbadapter.UpdateCommand.Parameters["@RemainSalary"].Value = RemainSalarySQL;
				SqlMoney AdvanceSQL = Advance;
				_dbadapter.UpdateCommand.Parameters["@Advance"].Value = AdvanceSQL;
				SqlMoney AssignmentSQL = Assignment;
				_dbadapter.UpdateCommand.Parameters["@Assignment"].Value = AssignmentSQL;
				SqlMoney SalaryPlusSQL = SalaryPlus;
				_dbadapter.UpdateCommand.Parameters["@SalaryPlus"].Value = SalaryPlusSQL;
				SqlMoney SalaryMinusSQL = SalaryMinus;
				_dbadapter.UpdateCommand.Parameters["@SalaryMinus"].Value = SalaryMinusSQL;
				SqlMoney SalarySQL = Salary;
				_dbadapter.UpdateCommand.Parameters["@Salary"].Value = SalarySQL;
				SqlMoney SalaryPaySQL = SalaryPay;
				_dbadapter.UpdateCommand.Parameters["@SalaryPay"].Value = SalaryPaySQL;
				SqlMoney SalaryDebtSQL = SalaryDebt;
				_dbadapter.UpdateCommand.Parameters["@SalaryDebt"].Value = SalaryDebtSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_SALARY_Save: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_SALARY_Save: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public DataSet HRM_SALARY_GetList()
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_SALARY_GetList");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Prepare();
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_SALARY_GetList: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
		public DataSet HRM_SALARY_Get(Guid SalaryTableListID, String EmployeeCode)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_SALARY_Get");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@SalaryTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.SelectCommand.Prepare();
				SqlGuid SalaryTableListIDSQL = SalaryTableListID;
				_dbadapter.SelectCommand.Parameters["@SalaryTableListID"].Value = SalaryTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.SelectCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_SALARY_Get: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
	}
}
